﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Drawing;
using System.Text;
using System.Threading.Tasks;
using Homework.Properties;

namespace Homework
{
    class BulletCold
    {
        //定义子弹速度
        private int SpeedY;
        //获得游戏对象的矩形
        public Rectangle rectangle
        {
            get;
            set;
        }

        public BulletCold(Rectangle rec)
        {
            //对矩形赋值
            rectangle = rec;
            //给子弹速度赋值
            SpeedY = 10;
        }

        /// <summary>
        /// 绘图函数
        /// </summary>
        /// <param name="graphics"></param>
        public void Draw(Graphics graphics)
        {
            graphics.DrawImage(Properties.Resources.BulletTwo, rectangle);

        }
        /// <summary>
        /// 处理玩家子弹的移动
        /// </summary>
        public void Move()
        {
            //让子弹发出
            this.rectangle = new Rectangle(this.rectangle.X, this.rectangle.Y + SpeedY, rectangle.Width, rectangle.Height);
            //子弹发出后 从游戏区域打出 而不是停留
            if (this.rectangle.Y >= 631)
            {
                this.rectangle = new Rectangle(this.rectangle.X, 1000, rectangle.Width, rectangle.Height);
            }
        }
    }
}
